import {request} from "@/http";
import type {
    BookingDetails,
    collectionPagadata,
    EvaluationrecordData, ID, Modifyone, passWorddata,
    phoneNumberdata, Psychological, Result, submite, thenetwork, Verification
} from "@/http/Personal center/PersonalCenter";
import type {Ref, UnwrapRef} from "vue";

// 编辑资料
const Editingdata = function () {
    return request({method: 'get', url: '/system/student/info'})
}
// 我的预约
const appointment = function () {
    return request({method: 'get', url: '/appointment/me'})
}
// 我的咨询
// const Myappointment = function (data: BookingDetails) {
//     return request({method: 'get', url: '/record/list',data})
const Myappointment = function (data: UnwrapRef<{ studentId: string; pageSize: number; pageNum: number }>) {
    return request({method: 'get', url: `/appointment/me/completed?pageSize=10&pageNum=1`,data})
}
// 测评记录
const Evaluationrecord = function (data: EvaluationrecordData) {
    return request({
        method: 'get', url: '/evaluation/student/record',
        data: data
    })
}
// 我的收藏
const collectionPaga = function (data: collectionPagadata) {
    return request({method: 'get', url: '/system/collect/list'})
}
// 我的客服
const CustomerService = function () {
    return request({method: 'get', url: '/system/dict/data/type/customer_service'})
}
// 手机号设置
const phoneNumber = function (data: phoneNumberdata) {
    return request({method: 'post', url: '/system/student/editPhone', data})
}
// 修改密码
const passWord = function (data:passWorddata) {
    return request({
        method: 'post', url: '/system/student/editPassword',data,config:{
            headers:{
                "Content-Type":'multipart/form-data'
            }
        }})
}
// 修改头像
const HeadModify = function (data: any) {
    const formData = new FormData();
    formData.append("avatar", data)
    return request({
        method: 'post', url: '/system/student/avatar', data: formData,config:{
            headers:{
                "Content-Type":'multipart/form-data'
            }
        }
    })
}
// 修改昵称 性别 生日
const Modify = function (data: Modifyone) {
    return request({method: 'post', url: '/system/student/edit', data})
}
// 获取验证码
const Verificationcode = function (data: any) {
    return request({method: 'post', url: '/student/sendSms', data})
}
// 心理测评列表
const Psychologicalevaluation = function (data: Psychological) {
    return request({method: 'get', url: '/evaluation/student/list', data})
}
// 心理详情
const Title = function (ID: any) {
    return request({method: 'get', url: `/evaluation/student/test/${ID}`})
}
// 测评提交
const submit = function (data: UnwrapRef<{ studentId: any; ids: any[]; assessmentId: string }>) {
    return request(({method: 'post', url: '/evaluation/student/submit', data}))
}
//测评结果
const evaluationresults = function (data: Result) {
    return request({method: 'get', url: `/evaluation/management/set/list`, data})
}
// 消息列表
const messagelist=function (id:any){
    return request({method:'get',url:`/system/list/list/${id}`,data:{pageSize:1000,pageNumber:1}})
}
// 未读消息统计
const Unread=function (id:any){
    return request({method:'get',url:`/system/list/unreadCount/${id}`})
}
// 更新消息已读状态
const read=function (data:any){
    return request({method:'post',url:`/system/list/update`,data})
}
// 咨询详情
const consultation=function (id:any){
    return request({method:'get',url:`/appointment/${id}`})
}
export {
    consultation,
    read,
    Unread,
    messagelist,
    Editingdata,
    submit,
    evaluationresults,
    Title,
    Psychologicalevaluation,
    Verificationcode,
    Modify,
    HeadModify,
    passWord,
    phoneNumber,
    appointment,
    Evaluationrecord,
    Myappointment,
    collectionPaga,
    CustomerService
}